<template>
  <div class="detail-page">
    <div class="page-header">
      <div class="title-box">
        <el-button class="back-button" icon="el-icon-back" @click="goback">返回</el-button>
        <div class="page-title">组织信息详情</div>
      </div>
      <div>
        <el-button type="primary" class="back-button" @click="detailToEdit">编辑</el-button>
      </div>
    </div>
    <div class="page-body">
      <div class="titleStyle">
        <span>基本信息</span>
      </div>
      <div class="organization-image-box">
        <img class="organization-image" src="" />
      </div>
      <el-descriptions direction="vertical" :column="2">
        <el-descriptions-item :span="2" label="党组织全称">{{ form.fullNamePartyOrg }}</el-descriptions-item>
        <el-descriptions-item :span="2" label="党组织代码">{{ form.partyOrgCode }}</el-descriptions-item>
        <el-descriptions-item :span="2" label="上级党组织">{{ form.parentFullNamePartyOrg }}</el-descriptions-item>
        <el-descriptions-item :span="2" label="党组织简称">{{ form.partyOrgAbb }}</el-descriptions-item>
        <el-descriptions-item label="党组织联系人">{{ form.partyOrgContactName }}</el-descriptions-item>
        <el-descriptions-item label="党组织联系方式">{{ form.partyOrgContactInfo }}</el-descriptions-item>
        <el-descriptions-item label="传真">{{ form.fax }}</el-descriptions-item>
        <el-descriptions-item label="邮编">{{ form.zip }}</el-descriptions-item>
        <el-descriptions-item label="组织类别">{{ orgClassList[form.orgCategory] }}</el-descriptions-item>
        <el-descriptions-item label="党组织属地关系">{{ form.partyOrgTerrRela }}</el-descriptions-item>
        <el-descriptions-item label="党组织建立日期">{{ form.partyOrgEstabTime }}</el-descriptions-item>
        <el-descriptions-item label="党组织领导班子届次">{{ form.partyOrgSessLeaderTeam }}</el-descriptions-item>
        <el-descriptions-item label="党组织开展评议日期">{{ form.partyOrgDateReview }}</el-descriptions-item>
        <el-descriptions-item label="党组织结束评议日期">{{ form.partyOrgDateEnd }}</el-descriptions-item>
        <el-descriptions-item label="领导集体当选日期">{{ form.leadersElectedDate }}</el-descriptions-item>
        <el-descriptions-item label="该届届满日期">{{ form.termExpiresDate }}</el-descriptions-item>
        <el-descriptions-item label="组织通讯地址">{{ form.orgMailingAddress }}</el-descriptions-item>
      </el-descriptions>
      <div class="titleStyle">
        <span>单位信息</span>
      </div>
      <el-descriptions direction="vertical" :column="2">
        <el-descriptions-item label="党组织所在单位情况">{{ unitSituation[form.partyOrgSituationUnit] }}</el-descriptions-item>
        <el-descriptions-item label="党组织所在单位情况代码">{{ form.partyOrgSituationUnitCode }}</el-descriptions-item>
        <el-descriptions-item label="单位名称">{{ form.unitName }}</el-descriptions-item>
        <el-descriptions-item label="党组织所在单位代码">{{ form.unitCode }}</el-descriptions-item>
        <el-descriptions-item label="单位类别">{{ unitClassList[form.unitCategory] }}</el-descriptions-item>
        <el-descriptions-item label="单位隶属关系">{{ unitAffiliation }}</el-descriptions-item>
        <el-descriptions-item label="单位建立党组织的情况">{{ form.unitInfo }}</el-descriptions-item>
      </el-descriptions>
      <div class="titleStyle">
        <span>奖惩信息</span>
      </div>
      <el-table
        :data="tableData"
      >
        <el-table-column prop="name" align="center" label="奖惩名称" />
        <el-table-column prop="rewardPunishDate" align="center" label="奖惩日期" />
        <el-table-column prop="illustrate" align="center" label="奖惩说明" />
        <el-table-column prop="approvePartyOrgName" align="center" label="批准奖惩的党组织" />
      </el-table>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      form: {},
      tableData: [],
      orgClassList: ['党委', '党总支', '党支部'],
      unitClassList: ['企业', '农村', '机关', '学校', '科研院所', '街道社区', '社会团体', '社会中介组织', '人民解放军连队', '其他基层单位'],
      unitSituation: ['与上级党组织相同', '法人单位', '联合支部', '其他']
    }
  },
  methods: {
    init (row) {
      this.form = { ...row }
      this.tableData = row?.rewardPunishInfoVOList || []
    },
    goback () {
      this.$emit('goback')
    },
    detailToEdit () {
      this.$emit('detailToEdit', this.form)
    }
  }
}
</script>
<style scoped lang="scss">
  .page-header {
    display: flex;
    height: 60px;
    align-items: center;
    border-bottom: 1px solid #ddd;
    justify-content: space-between;
    .title-box {
      display: flex;
      height: 60px;
      align-items: center;
    }
    .back-button {
      margin-right: 16px;
    }
    .page-title {
      font-size: 18px;
      font-weight: 600;
    }
  }
  .page-body {
    height: calc(100vh - 130px);
    overflow-y: auto;
    position: relative;
    .organization-image-box {
      width: 240px;
      height: 180px;
      border: 1px solid #000;
      position: absolute;
      left: 50%;
      .organization-image {
        width: 100%;
        height: 100%;
      }
    }
    .titleStyle {
      font-weight: 600;
      height: 35px;
      line-height: 35px;
      padding-left: 10px;
      padding-right: 10px;
      margin-bottom: 8px;
      background-color: #d8eff9;
      display: flex;
      justify-content: space-between;
    }
  }
</style>
